//
//  Global.h
//  jinghui
//
//  Created by 史宵宵 on 2017/5/16.
//  Copyright © 2017年 史宵宵. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AppDelegate.h"

@interface Global : NSObject

//#define URL_BASE @"http://result.eolinker.com/xtTlA2w31af0d83ca5d184276c717369cb83f4f33be05a0?uri="//文档中
//#define URL_BASE @"http://1711f34u78.imwork.net" //白天可以用

#define WXAPPID                    @"wx6504f81187f88050"              //微信APPID
#define WXAPPSECRET                @"17a914fa1229c7a29a1a97a9e4df99c5"//微信APPSECRET
#define ALiPAYAppid      @"alipay2088921298312274"

#define URL_BASE @"http://app.ziyushi.com"//不测试就换到这个, 这个地址更新不一定最新的，每天段时间会发布上去
//#define IMAGE_URL(url) [NSString stringWithFormat:@"%@%@",URL_BASE,url]
//  app version版本
#define IOSSHORTAPPVERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
//  app build版本
#define IOSAPPVERSION      [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
//  app名称
#define IOSAPPNAME         [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]

#define LOCATIONAPPKEY @"c912b7dffb5339e9f2ec151fa28c84fa"

#define strIsEmpty(str) ( [str isKindOfClass:[NSNull class]] ||[str isEqualToString:@"null"] || [str isEqualToString:@"<null>"] || str == nil || [str length]<1 ? YES : NO )

#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height
#define KREFRESHROWS  @"10"

#define kNumbersPeriod  @"0123456789."


#define RGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

#define topRedColor [UIColor colorWithRed:228/255.0 green:65/255.0 blue:67/255.0 alpha:1.0]
#define shouldgraycolor [UIColor colorWithRed:203/255.0 green:203/255.0 blue:203/255.0 alpha:1.0]
#define shouldbluecolor [UIColor colorWithRed:31/255.0 green:134/255.0 blue:200/255.0 alpha:1]
//navigation的背景色

#define KBACKNAVIGATIONCOLOR           [UIColor colorWithRed:97.0/255.0f green:182.0/255.0f blue:89.0/255.0f alpha:1.0]
#define KBACKGROUNDCOLOR RGBColor(246,246,246)
#define KTEXTBLACKCOLOR RGBColor(2,2,2)
#define KTEXTGRAYLIGHTCOLOR RGBColor(238,238,238)
#define KHEADERTITLECOLOR RGBColor(135,135,135)
#define KIMAGEVIEWBACKGROUNDCOLOR RGBColor(207,207,207)
#define KTEXTMAINCOLOR RGBColor(83,83,83)
#define KBORDERCOLOR RGBColor(211,212,213)
#define KMONEYCOLOR  RGBColor(238,62,55)

// 随机色
#define rgba(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]

#define RandomColor RGBColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
#define homepadding 20
#define itemPerLine 4
#define kItemW (kScreenW-homepadding*(itemPerLine+1))/itemPerLine
#define kItemH 25


//第一次进入应用--引导页
#define GUIDE_VERSION              @"guide_version"
//用户的token
#define KUSERTOKEN           @"userTokenInfo"

//默认头像
#define KDEFAULTHEAD               [UIImage imageNamed:@"defaultHead"]
#define KSIDEDEFAULTHEAD           [UIImage imageNamed:@"sideDefaultHead"] //首页排行榜默认头像
//列表默认图片
#define KRECOMMENDLISTDEFAULT               [UIImage imageNamed:@"recommendlistDefault"] //首页推荐列表
#define KBANNERDEFAULT               [UIImage imageNamed:@"bannerDefault"] //首页banner
#define KLIVECLASSDEFAULT               [UIImage imageNamed:@"liveClassDefine"] //直播课程默认图片
//详情默认图片
#define KDETAILFAULT               [UIImage imageNamed:@"detailDefault.png"]

+ (AppDelegate *)appdelegete;
+ (UIColor *)colorWithHexValue:(NSUInteger)hexValue alpha:(CGFloat)alpha;
//保存个人登录token
+ (void)setUserTokenInfo:(NSString*)userTokenInfoDic;
//读取个人登录token
+ (NSString*)getUserTokenInfo;
// 获取指定最大宽度、最大高度、字体大小的string的size
+ (CGSize)getSizeOfString:(NSString *)string maxWidth:(float)width maxHeight:(float)height withFontSize:(CGFloat)fontSize;
//修改字符串行高
+ (NSAttributedString*)returnAttributedstringFromstring:(NSString *)string andlineHeight:(CGFloat)lineHeight;
//修改字符串的颜色或及大小
+ (NSMutableAttributedString*)returnAttributedstringFromstring:(NSString *)string andlocation:(NSInteger)location andLength:(NSInteger)length andAttributeStringColor:(UIColor *)color andFondSize:(NSInteger)size;
//获取当前时间的字符串
+ (NSString *)timeStamp;
//获取当前时间YYYY-MM-dd
+ (NSString *)getCurrentDate;
//获取当前时间YYYY-MM-dd HH:mm:ss
+ (NSString *)getCurrentDateTime;
//设置状态栏颜色
+ (void)setStatusBarBackgroundColor:(UIColor *)color;
//弹框
+ (void)showActivityWithView:(UIView *)showView withText:(NSString *)text;
//验证手机号是否合法
+ (BOOL)validateMobile:(NSString *)mobile;
//获取俩个时间是时间差
+ (int)callDatePoor:(NSString *)timeString;
//时间字符串转yyyy-MM-dd HH:mm:ss
+ (NSString *)callBackDateTime:(NSString *)timeString;
//时间戳转化为时间字符串
+ (NSString *)timeWithTimeIntervalString:(NSString *)timeString;
@end
